using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using SailHero.Soft.FrameWork.Models;

namespace SailHero.Soft.FrameWork.Mapping.AuthCodeDB
{
    public class Sys_UserMap : EntityTypeConfiguration<Sys_User>
    {
        public Sys_UserMap()
        {
            // Primary Key
            this.HasKey(t => t.UserID);

            // Properties
            this.Property(t => t.UserID)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Account)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.Password)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.UserCName)
                .HasMaxLength(20);

            this.Property(t => t.UserEName)
                .HasMaxLength(20);

            this.Property(t => t.Email)
                .HasMaxLength(20);

            this.Property(t => t.Telephone)
                .HasMaxLength(20);

            this.Property(t => t.Mobile)
                .HasMaxLength(20);

            this.Property(t => t.DepartID)
                .HasMaxLength(50);

            this.Property(t => t.BirthDay)
                .HasMaxLength(50);

            this.Property(t => t.JobNumber)
                .HasMaxLength(20);

            this.Property(t => t.Address)
                .HasMaxLength(50);

            this.Property(t => t.Position)
                .HasMaxLength(20);

            this.Property(t => t.LastLoginIP)
                .HasMaxLength(20);

            this.Property(t => t.Remark)
                .HasMaxLength(100);

            this.Property(t => t.Creator)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Sys_User");
            this.Property(t => t.UserID).HasColumnName("UserID");
            this.Property(t => t.Account).HasColumnName("Account");
            this.Property(t => t.Password).HasColumnName("Password");
            this.Property(t => t.UserCName).HasColumnName("UserCName");
            this.Property(t => t.UserEName).HasColumnName("UserEName");
            this.Property(t => t.Email).HasColumnName("Email");
            this.Property(t => t.Telephone).HasColumnName("Telephone");
            this.Property(t => t.Mobile).HasColumnName("Mobile");
            this.Property(t => t.DepartID).HasColumnName("DepartID");
            this.Property(t => t.Sex).HasColumnName("Sex");
            this.Property(t => t.BirthDay).HasColumnName("BirthDay");
            this.Property(t => t.JobNumber).HasColumnName("JobNumber");
            this.Property(t => t.Address).HasColumnName("Address");
            this.Property(t => t.Position).HasColumnName("Position");
            this.Property(t => t.LastLoginTime).HasColumnName("LastLoginTime");
            this.Property(t => t.LastLoginIP).HasColumnName("LastLoginIP");
            this.Property(t => t.IsEnable).HasColumnName("IsEnable");
            this.Property(t => t.IsDelete).HasColumnName("IsDelete");
            this.Property(t => t.IsOnline).HasColumnName("IsOnline");
            this.Property(t => t.Remark).HasColumnName("Remark");
            this.Property(t => t.Creator).HasColumnName("Creator");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
        }
    }
}
